<!-- 工作量统计参数 jsp -->
<%@ page contentType="text/html; charset=UTF-8"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/jsp/common/common.jsp"%>
<html>
	<head>
		<script type="text/javascript" src="<%=contextPath%>/js/jquery.autogrow.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/validator.js"></script> 
		<script type="text/javascript" src="<%=contextPath%>/js/My97DatePicker/WdatePicker.js"></script>
		<script type="text/javascript" language="javascript">  
		
		$(document).ready (function() {
			//$('textarea.indispensable_left').autogrow();	
			$('textarea').autogrow();		
		});
			
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				        {
				            text: '刷新',
				            icon:"<%=contextPath%>/images/refresh-menu.gif",
				            handler:cmt
				        } ,'-',  
				        {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:toCheck
				        }
			    	]
			    });
			});

			/*
			 * 校验是否为整数
			 */
			function validateInteger(ctl) {
			  var n = ctl.value; 
			  var reg = /^(0|[1-9][0-9]*)$/;
			  return reg.test(n);
			}
			
			/*
			 * 小数点一位验证
			 */
			function validateDouble(ctl) {
			  var n = ctl.value; 
			  var reg = /(^[1-9]{1}\d{0,1}$)|(^0$)|(^0\.\d{1,2}$)|(^([1-9]{1}\d{0,1}){1,1}(\.){1,1}(\d{1,2}){1,1}$)$/;
			  return reg.test(n);
			}
				function validateDoubleAndHandred(ctl) {
			  var n = ctl.value; 
			  var reg = /(^[1-9]{1}\d{0,1}$)|(^100$)|(^0$)|(^0\.\d{1,2}$)|(^([1-9]{1}\d{0,1}){1,1}(\.){1,1}(\d{1,2}){1,1}$)$/;
			  return reg.test(n);
			}
			String.prototype.endWith=function(str){
				if(str==null||str==""||this.length==0||str.length>this.length)
				return false;
				if(this.substring(this.length-str.length)==str)
				return true;
				else
				return false;
				return true;
				}
			
		// 验证通过后提交
			function toCheck(){

				var str0 = 0;
				var str1 = 0;
				var str2 = 0;
				var str3 = 0
				var msg = "";
	
				for (var i = 0; i < frmM.elements.length; i++)
				{
					var e = frmM.elements[i];
					e.style.backgroundColor = "white";
				    if (e.type == "text") {
				    	if (e.name.endWith("0")) {
				    		if (!validateInteger(e)) {
				    			e.style.backgroundColor="red";
				    			++str0;
				    		}
				    	} else if (e.name.endWith("1") || e.name.endWith("2") || e.name.endWith("3")) {
				    		if (!validateDouble(e)) {
				    			e.style.backgroundColor="yellow";
				    			++str1;
				    		}
				    	} else if ( e.name.endWith("0v")) {
				    		if (!validateDoubleAndHandred(e)) {
				    			e.style.backgroundColor="blue";
				    			++str3;
				    		}
				    	}
				    }
				    
				}
				
				if (frmM.elements["entity.yjks"].value == "" || frmM.elements["entity.yjjs"].value == "") {
					msg += ++str2 +  "夜班起始时间必须输入\n";
				}
				
				if (str0 > 0) {
					msg += ++str2 + "红色底色框必须输入，并且输入整数\n";
				}
				
				if (str1 > 0) {
					msg += ++str2 + "黄色底色框必须输入，并且输入两位整数两位小数";
				}
				
				if (str3 > 0) {
					msg += ++str2 + "蓝色底色框必须输入，并且输入0～100数值，小数点两位";
				}
								
				
				if (msg.length > 0) {
					alert("系统检测到您的提交有以下错误：\t\t\t\t\n" + msg);
					return;
				}
			  	
			  	comt();

		    }
		 </script>  
	</head>
	<body>
		<div id = "tbar" style="position:absolute;display:block left:0px; top:0px; width:100%; height:35px; z-index:1;"></div>
		<br>
		<div id="Layer" style="position:absolute;display:block left:0px; top:35px; width:100%; height:94%; z-index:1000; overflow:auto;">
		
		<!-- 信息提示 -->
		<div id="result" align="center"><font color="red">${info }</font></div>
		<form id="frmM" name="frmM" method="POST">
			<s:hidden name="entity.id"/>
			
			<table width="100%" id="infotab">
				<tr>
					<th width="120" nowrap>
						<font color="red">*</font>&nbsp;夜班起始时间：
					</th>
					<td>
						每日&nbsp;<input type="text" size="5" onclick="WdatePicker({dateFmt:'HH:mm',el:$dp.$('entity.yjks')})" name="entity.yjks" datatype="Require" readonly="true" value="${entity.yjks}" msg="夜班开始时间必须输入。"/>
						<img onclick="WdatePicker({dateFmt:'HH:mm',el:$dp.$('entity.yjks')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
						&nbsp;~ 次日&nbsp;
						<input type="text" size="5" onclick="WdatePicker({dateFmt:'HH:mm',el:$dp.$('entity.yjjs')})" name="entity.yjjs" datatype="Require" readonly="true" value="${entity.yjjs}" msg="夜班结束时间必须输入。"/>
						<img onclick="WdatePicker({dateFmt:'HH:mm',el:$dp.$('entity.yjjs')})" src="<%=contextPath%>/js/My97DatePicker/skin/datePicker.gif" width="16" height="22" align="absmiddle">
						
					</td>
				</tr>
				<tr><td colspan="2"><font color="red">如果不需要按照夜间计算<夜间倍数>设置为1</font></td></tr>
			</table>
			<table width="100%" >
				<tr width="100%">
					<th colspan="11" style="width:100%">
						<center>计划</center>
					</th>
				</tr>
			</table>
			<table width="100%" id="listtab">
				<tr width="100%">
					<th align="center" width="60">
						&nbsp;
					</th>
					<th colspan="2" align="center">
						总工作负责人
					</th>
					<th colspan="3" align="center">
						编写人
					</th>
					<th colspan="1" align="center">
						录入人
					</th>
						
				</tr>
				<tr>
					<th align="center" width="60">
						&nbsp;
					</th>				
					<th align="center">
						一种票
					</th>
					<th align="center">
						二种票
					</th>	
					<th align="center">
						作业指导书
					</th>
					<th align="center">
						班组作业控制卡
					</th>
					<th align="center">
						工序质量控制卡
					</th>
					<th align="center">
						记录回填
					</th>
									
				</tr>
				<tr>
					<th align="center" width="60">
						人/次
					</th>				
					<td align="center">
						<input type="text" value="${entity.cz00}"  maxlength = "2" name="entity.cz00" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz10}"  maxlength = "2" name="entity.cz10" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz20}"  maxlength = "2" name="entity.cz20" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz30}"  maxlength = "2" name="entity.cz30" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz40}"  maxlength = "2" name="entity.cz40" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz50}"  maxlength = "2" name="entity.cz50" style="width:100%">
					</td>
													
				</tr>	
				<tr>
					<th align="center" width="60">
						夜间倍数
					</th>				
					<td align="center">
						<input type="text" value="${entity.cz01}" maxlength = "5"  name="entity.cz01" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz11}" maxlength = "5" name="entity.cz11" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz21}" maxlength = "5" name="entity.cz21" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz31}" maxlength = "5" name="entity.cz31" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz41}" maxlength = "5" name="entity.cz41" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz51}" maxlength = "5" name="entity.cz51" style="width:100%">
					</td>
														
				</tr>	
				<tr>
					<th align="center" width="60">
						系数
					</th>				
					<td align="center">
						<input type="text" value="${entity.cz61}" maxlength = "5"  name="entity.cz61" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz71}" maxlength = "5" name="entity.cz71" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz81}" maxlength = "5" name="entity.cz81" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz91}" maxlength = "5" name="entity.cz91" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz62}" maxlength = "5" name="entity.cz62" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz72}" maxlength = "5" name="entity.cz72" style="width:100%">
					</td>
														
				</tr>	
				<tr>
					<th align="center" width="60">
						分值
					</th>				
					<td align="center">
						<input type="text" value="${entity.cz02}" maxlength = "5" name="entity.cz02" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz12}" maxlength = "5" name="entity.cz12" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz22}" maxlength = "5" name="entity.cz22" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz32}" maxlength = "5" name="entity.cz32" style="width:100%">
					</td>
					<td align="center">
						<input type="text" value="${entity.cz42}" maxlength = "5" name="entity.cz42" style="width:100%">
					</td>	
					<td align="center">
						<input type="text" value="${entity.cz52}" maxlength = "5" name="entity.cz52" style="width:100%">
					</td>
															
				</tr>												
			</table>
			
					<td width="45%">
						<table width="100%" >
							<tr width="100%">
								<th colspan="4" style="width:100%">
									<center>缺陷</center>
								</th>
							</tr>
						</table>
						<table width="100%" id="listtab">
							<tr width="100%">
								<th align="center" width="60">
									&nbsp;
								</th>
								<th colspan="4" align="center">
									消缺次数
								</th>			
							</tr>
							<tr>
								<th align="center">
									&nbsp;
								</th>				
								<th align="center">
									紧急
								</th>
								<th align="center">
									重大
								</th>	
								<th align="center">
									一般
								</th>
								<th align="center">
									不满意项
								</th>							
							</tr>
							<tr>
								<th align="center" width="60">
									人/次
								</th>				
								<td align="center">
									<input type="text" value="${entity.qx00}"  maxlength = "2" name="entity.qx00" style="width:100%">
								</td>
								<td align="center">
									<input type="text" value="${entity.qx10}"  maxlength = "2" name="entity.qx10" style="width:100%">
								</td>	
								<td align="center">
									<input type="text" value="${entity.qx20}"  maxlength = "2" name="entity.qx20" style="width:100%">
								</td>
								<td align="center">
									<input type="text" value="${entity.qx30}"  maxlength = "2" name="entity.qx30" style="width:100%">
								</td>												
							</tr>	
							<tr>
								<th align="center" width="60">
									夜间倍数
								</th>				
								<td align="center">
									<input type="text" value="${entity.qx01}" maxlength = "5" name="entity.qx01" style="width:100%">
								</td>
								<td align="center">
									<input type="text" value="${entity.qx11}" maxlength = "5" name="entity.qx11" style="width:100%">
								</td>	
								<td align="center">
									<input type="text" value="${entity.qx21}" maxlength = "5" name="entity.qx21" style="width:100%">
								</td>
								<td align="center">
									<input type="text" value="${entity.qx31}" maxlength = "5" name="entity.qx31" style="width:100%">
								</td>															
							</tr>	
							<tr>
								<th align="center" width="60">
									分值
								</th>				
								<td align="center">
									<input type="text" value="${entity.qx02}" maxlength = "5" name="entity.qx02" style="width:100%">
								</td>
								<td align="center">
									<input type="text" value="${entity.qx12}" maxlength = "5" name="entity.qx12" style="width:100%">
								</td>	
								<td align="center">
									<input type="text" value="${entity.qx22}" maxlength = "5" name="entity.qx22" style="width:100%">
								</td>
								<td align="center">
									<input type="text" value="${entity.qx32}" maxlength = "5" name="entity.qx32" style="width:100%">
								</td>															
							</tr>
							
							
			<table width="520" id="listtab">
							<tr width="100%">
							
								<th align="center">
									&nbsp;
								</th>
								<th align="center">
									副班长
								</th>
								<th align="center">
									技术资料员
								</th>	
								<th align="center">
									安全培训员
								</th>
								<th align="center">
									综合事务
								</th>	
								<th colspan="2" align="center">
									周末
								</th>											
							</tr>
							
							<tr>
							<th align="center" width="60">
									分值
								</th>
								<td align="center">
									<input type="text" value="${entity.px01v}" maxlength = "5" name="entity.px01v" style="width:100%">
								</td>
								<td align="center">
									<input type="text" value="${entity.px11v}" maxlength = "5" name="entity.px11v" style="width:100%">
								</td>	
								<td align="center">
									<input type="text" value="${entity.px21v}" maxlength = "5" name="entity.px21v" style="width:100%">
								</td>
								<td align="center">
								   <input type="text" value="${entity.px31v}" maxlength = "5" name="entity.px31v" style="width:100%">
								</td>	
								<td align="center">
								  周末系数
								</td>	
								<td align="center" width="50">
								   <input type="text" value="${entity.xk21}" maxlength = "5" name="entity.xk21" style="width:100%">
								</td>			
							</tr>
																				
						</table>
			<hr>
		</form>
		</div>
	</body>
</html>
<script language="javascript">

	 // 保存
     function comt(){
     	document.frmM.action = "<%=contextPath%>/gzltjPara!save.do";
     	document.frmM.submit();
     }
     
	 // 刷新
	 function cmt(){
		document.frmM.action = "<%=contextPath%>/gzltjPara!initDetail.do";
		document.frmM.submit();
	 }

</script>